package com.chinh.config;

import com.chinh.annotation.AopTest;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

/**
 * @author chinh
 * @date 2021/7/1
 */
//@Aspect
//@Component
public class AopConfig {

	@Before("@annotation(aopTest)")
	public void before(JoinPoint joinPoint, AopTest aopTest) throws Throwable {
		System.out.println("Before");
	}

	@After("@annotation(aopTest)")
	public void after(JoinPoint joinPoint, AopTest aopTest) throws Throwable {
		System.out.println("After");
	}

	/*@AfterReturning("@annotation(aopTest)")
	public void afterReturning(JoinPoint joinPoint, AopTest aopTest) throws Throwable {
		System.out.println("AfterReturning");
	}*/
}
